<template>
	<view class="detail-box">
		<text class="detail-title">{{detail.title}}</text>
		<view class="detail-info">
			<view class="detail-info-left">
				<image :src="detail.avatar"></image>
				<view class="text-info">
					<view>{{detail.nickname}}</view>
					<text>分布于：{{detail.date}}</text>
				</view>
			</view>
			<text class="detail-info-right">收 藏</text>
		</view>
		<view class="detail-content"><rich-text :nodes="detail.content"></rich-text></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:0,
				detail:{}
			}
		},
		onLoad(options) {
			this.id = options.id
			this.getDetail()
		},
		methods: {
			async getDetail(){
				const res = await this.$myRequest({
					url:'/index.php?m=app&c=content&a=get_news_content&id='+this.id
				})
				this.detail = res.data.data
			},
		}
	}
</script>

<style>
	.detail-box{
		padding: 10px;
	}
	.detail-box .detail-title{
		display: inline-block;
		font-size: 16px;
		font-weight: bold;
	}
	.detail-info{
		display: flex;
		justify-content: space-between;
		font-size: 12px;
		margin: 20px auto;
	}
	.detail-info .detail-info-left{
		display: flex;
		justify-content: space-between;
	}
	.detail-info .detail-info-left image{
		width: 30px;
		height: 30px;
		border-radius: 50%;
	}
	.text-info{
		margin-left: 5px;
	}
	.detail-info-right{
		line-height: 20px;
		height: 20px;
		margin-top: 4px;
		text-align: center;
		width: 60px;
		background-color: #FF0000;
		color: #FFFFFF;
		border-radius: 25px;
	}
</style>
